<!-- <script setup lang="ts">
import HomePage from "./components/HomePage.vue";
</script>

<template>
  <main>
    <HomePage />
  </main>
</template>

<style scoped>
header {
  line-height: 1.5;
}

.logo {
  display: block;
  margin: 0 auto 2rem;
}

@media (min-width: 1024px) {
  header {
    display: flex;
    place-items: center;
    padding-right: calc(var(--section-gap) / 2);
  }

  .logo {
    margin: 0 2rem 0 0;
  }
}
</style> -->

<template>
  <router-view />
</template>
<script setup>
import { useMainStore } from "@/stores";
import { ref, watch } from "vue";
import { useRoute, useRouter } from "vue-router";
const store = useMainStore();
const route = useRoute();

const whitePath = ["/login", "/index", "/"];
console.log("route:", route);
watch(
  () => route.path,
  (to, from) => {
    // 这里的 to 是 path 字符串
    if (whitePath.indexOf(to) === -1) {
      let obj = {
        name: route.name,
        path: to,
      };
      store.ADD_TABS(obj);
    }
  },
  { immediate: true }
);
</script>
<style>
html,
body,
#app {
  height: 100%;
  position: relative;
}

.app-container {
  padding: 20px;
}

/* 保证悬浮按钮在最顶层 */
.chatbot-wrapper {
  z-index: 9999;
  position: fixed;
  right: 30px;
  bottom: 30px;
}
</style>
